create database test
go

use TEST
go

CREATE  TABLE users (
  username VARCHAR(45) NOT NULL ,
  password VARCHAR(45) NOT NULL ,
  enabled TINYINT NOT NULL DEFAULT 1 ,
  PRIMARY KEY (username));
  
  CREATE TABLE user_roles (
  user_role_id INT NOT NULL identity(1,1),
  username VARCHAR(45) NOT NULL,
  ROLE VARCHAR(45) NOT NULL,
  PRIMARY KEY (user_role_id),
  Constraint uni_username_role UNIQUE(ROLE,username),
    CONSTRAINT fk_username FOREIGN KEY (username) REFERENCES users (username));
    
    INSERT INTO users(username,password,enabled)
VALUES ('mkyong','123456', 1);
INSERT INTO users(username,password,enabled)
VALUES ('alex','123456', 1);
 
INSERT INTO user_roles (username, ROLE)
VALUES ('mkyong', 'ROLE_USER');
INSERT INTO user_roles (username, ROLE)
VALUES ('mkyong', 'ROLE_ADMIN');
INSERT INTO user_roles (username, ROLE)
VALUES ('alex', 'ROLE_USER');